Step 19: Test a DELETE request
Update tests/routes/bookmakrs.test.js
and add the following test:
it("Delete a bookmark given its ID", async () => {
const index = Math.floor(Math.random() * numBookmarks);
const bookmark = bookmarkDao.readAll({})[index];
const response = await request.delete(`/bookmarks/${bookmark.id}`);
expect(response.status).toBe(200);
expect(response.body.data).toMatchObject(bookmark);
});
Run the tests in this file.
Save and commit all changes.